package com.suxin.close;

import java.io.Closeable;
import java.io.IOException;

/**
 * @author Tang
 * @classname MyCloseAbleTest
 * @description [  ]
 * @date 2021/2/5 11:08
 */
public class MyCloseAbleTest {

    public static void main(String[] args) {


        try (MyCloseAble myCloseAble = new MyCloseAble();){
            myCloseAble.readResource();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    static class MyCloseAble implements Closeable {

        @Override
        public void close() throws IOException {
            System.out.println("MyCloseAble...close...");
        }

        public void readResource() {
            System.out.println("readResource.....");
        }
    }

}